<?php

require '../model/equgamermodel.php';

class equgamercontrol{
	private $model;//业务模型
	private $view;

	public function __construct(){
		
		$this->view="../view/main.php?url=equgamer.php";
		$this->model=new equgamermodel();
	}


	public function load($view=null){
		if(empty($view))
		{				
			header("location:{$this->view}");
		}
		else{
			header("location:{$view}");
		}

	}
	
	/*
	 *
	*
	*/
	public function doAction($action){
		if($action=='rerider'){			
			$this->action_equgamerquery();
		}
		else if($action=='tian'){			
			$this->action_equgamertian();
		}
		else{
			$this->load();
		}

	}

	//骑手修改
	public function action_equgamerquery(){
		
		$equgamerid=$_GET['equgamerid'];
		$ming=$_POST['ming'];
		$zuo=$_POST['zuo'];
		$jia=$_POST['jia'];
	    if (!empty($ming) || !empty($zuo) || !empty($jia)){		
	    $equgamer=new  equgamermodel();
	    $equgamer->equgamerquery($equgamerid,$ming,$zuo,$jia);
		}
		$this->load($this->view);
	}
	//骑手添加
	public function action_equgamertian(){//&& !empty($img)
			$ming=$_POST['tming'];
			$level=$_POST['tlevel'];
			$zuo=$_POST['tzuo'];
			$jia=$_POST['tjia'];
			$upload=new upload();
			$img=$upload->upload_file();
	    $equgamer=new  equgamermodel();
	    $equgamer->equgamertian($ming,$level,$zuo,$jia,$img);//
		//}
		//回自己界面
		$this->load($this->view);
	}
	
}
?>